package com.my.radio;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class FrequencyListViewAdapter extends BaseAdapter {

	private List<FrequencyView> frequencyList;
	private int selectItem;
	private int preItemId;

	public FrequencyListViewAdapter(Context context, List<FrequencyView> list) {
		frequencyList = list;
		preItemId = -1;
		selectItem = 0;
		// TODO Auto-generated constructor stub
	}

	public int getCount() {
		return frequencyList.size();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int position) {		
		preItemId = position;	
			
//		if (selectItem != -1 && selectItem != position) {
//			frequencyList.get(selectItem).setBackgroundColor(0);
//		}

//		if (position != selectItem) {
//			Drawable myImage = frequencyList.get(position).getContext()
//					.getResources().getDrawable(
//							R.drawable.frequency_view_selected);
//			myImage.setBounds(0, 0, myImage.getIntrinsicWidth(), myImage
//					.getIntrinsicHeight());
//			frequencyList.get(position).setBackgroundDrawable(myImage);
//		}
		//selectItem = position;
		return 0;
	}

	public void paintPreItem(){
//		if (preItemId != -1){
//			frequencyList.get(preItemId).setBackgroundColor(0);
//		}
	}
	public View getView(int position, View convertView, ViewGroup parent) {
		return frequencyList.get(position).getView();
	}

	public void setSelectItem(int selectItem) {
		this.selectItem = selectItem;
	}
}
